package com.zrrd.learn.chapter08面向对象.pattern.singleton.thread;

/**
 * 优化
 *
 * @author wrn
 * @version 1.0
 * @date 2023/8/2 11:17
 */

public class Thread03 {

    public static void main(String[] args) {
        Runnable t1 = new Runnable() {
            @Override
            public void run() {
                System.out.println("我是线程");
            }
        };
        //run();
        //start();

        new Thread(t1).start();

        //lambda表达式
        Runnable t2 = ()->{
            System.out.println("我是线程");
        };

        new Thread(t2).start();

        //就用哪一个
        Thread t3 = new Thread(()->{
            System.out.println("ttt");
        });

        t3.start();

        Thread t4 = new Thread(()->{
            System.out.println("ttt"+Thread.currentThread().getName());
        },"哈尔滨");
        t4.start();

    }

}
